<?php

Class Pcache
{
    private static $predis = null;

    private function __construct()
    {
        if (is_null(self::$predis)) {
            Predis\Autoloader::register();
            $server       = array(
                'host'     => '127.0.0.1',
                'port'     => 6379,
                'database' => 0
            );
            self::$predis = new Predis\Client($server);
        }
    }

    public static function create()
    {
        if (is_null(self::$predis)) {
            new self();
        }
        return self::$predis;
    }

    private function __clone()
    {
        // TODO: Implement __clone() method.
    }
}